/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.edu.ifal.crazypizza.gui;

import javax.swing.JOptionPane;

/**
 *
 * @author Lucas
 */
public class FrmVendas extends javax.swing.JFrame {

    /**
     * Creates new form FrmVendas
     */
    public FrmVendas() {
      this.setExtendedState(MAXIMIZED_BOTH);
      initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        buttonGroup3 = new javax.swing.ButtonGroup();
        jLabel2 = new javax.swing.JLabel();
        lblNome = new javax.swing.JLabel();
        txtNome = new javax.swing.JTextField();
        jToggleButton1 = new javax.swing.JToggleButton();
        lblControleDeCaixa = new javax.swing.JLabel();
        lblProdutos = new javax.swing.JLabel();
        btnBebidas = new javax.swing.JRadioButton();
        btnPizzaPersonalizada = new javax.swing.JRadioButton();
        btnOutros = new javax.swing.JRadioButton();
        txtNumMesa = new javax.swing.JLabel();
        lblFormaPagamento = new javax.swing.JLabel();
        pnlClientes = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea2 = new javax.swing.JTextArea();
        btnCartaoCredito1 = new javax.swing.JRadioButton();
        btnAvista1 = new javax.swing.JRadioButton();
        imgVisa = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        btnAvista2 = new javax.swing.JRadioButton();
        btnAvista3 = new javax.swing.JRadioButton();
        btnAvista4 = new javax.swing.JRadioButton();
        btnCancelar = new javax.swing.JToggleButton();
        btnVender = new javax.swing.JToggleButton();
        ComboNMesa = new javax.swing.JComboBox();
        pnlFundoTexto = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        txtNumPedido1 = new javax.swing.JTextField();
        txtDataPedido1 = new javax.swing.JFormattedTextField();
        txtDataPedido = new javax.swing.JLabel();
        txtNumeroPedido = new javax.swing.JLabel();
        jRadioButton1 = new javax.swing.JRadioButton();
        imgHiper = new javax.swing.JLabel();
        lblVisa = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        lblImagem = new javax.swing.JLabel();

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/edu/ifal/crazypizza/imagens/Tela Login.jpg"))); // NOI18N

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("VENDAS");
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        lblNome.setText("Nome do cliente");
        getContentPane().add(lblNome, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 70, -1, -1));
        getContentPane().add(txtNome, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 70, 355, -1));

        jToggleButton1.setText("Buscar");
        getContentPane().add(jToggleButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(750, 70, -1, -1));

        lblControleDeCaixa.setFont(new java.awt.Font("Comic Sans MS", 1, 12)); // NOI18N
        lblControleDeCaixa.setText("CONTROLE DO CAIXA / PEDIDO");
        getContentPane().add(lblControleDeCaixa, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 30, -1, -1));

        lblProdutos.setFont(new java.awt.Font("Comic Sans MS", 1, 12)); // NOI18N
        lblProdutos.setText("PRODUTOS");
        getContentPane().add(lblProdutos, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 280, -1, -1));

        btnBebidas.setText("Bebidas");
        btnBebidas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBebidasActionPerformed(evt);
            }
        });
        getContentPane().add(btnBebidas, new org.netbeans.lib.awtextra.AbsoluteConstraints(650, 320, -1, -1));

        btnPizzaPersonalizada.setText("Pizza Personalizada");
        btnPizzaPersonalizada.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPizzaPersonalizadaActionPerformed(evt);
            }
        });
        getContentPane().add(btnPizzaPersonalizada, new org.netbeans.lib.awtextra.AbsoluteConstraints(490, 320, -1, -1));

        btnOutros.setText("Outros");
        btnOutros.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOutrosActionPerformed(evt);
            }
        });
        getContentPane().add(btnOutros, new org.netbeans.lib.awtextra.AbsoluteConstraints(760, 320, -1, -1));

        txtNumMesa.setFont(new java.awt.Font("Comic Sans MS", 1, 12)); // NOI18N
        txtNumMesa.setText("Nº da Mesa");
        getContentPane().add(txtNumMesa, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 340, -1, -1));

        lblFormaPagamento.setFont(new java.awt.Font("Comic Sans MS", 1, 12)); // NOI18N
        lblFormaPagamento.setText("FORMA DE PAGAMENTO:");
        getContentPane().add(lblFormaPagamento, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 460, -1, -1));

        pnlClientes.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jTextArea2.setEditable(false);
        jTextArea2.setColumns(20);
        jTextArea2.setLineWrap(true);
        jTextArea2.setRows(5);
        jScrollPane2.setViewportView(jTextArea2);

        javax.swing.GroupLayout pnlClientesLayout = new javax.swing.GroupLayout(pnlClientes);
        pnlClientes.setLayout(pnlClientesLayout);
        pnlClientesLayout.setHorizontalGroup(
            pnlClientesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlClientesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 516, Short.MAX_VALUE)
                .addContainerGap())
        );
        pnlClientesLayout.setVerticalGroup(
            pnlClientesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlClientesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE)
                .addContainerGap())
        );

        getContentPane().add(pnlClientes, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 110, -1, -1));

        buttonGroup1.add(btnCartaoCredito1);
        btnCartaoCredito1.setText("Cartão de Crédito");
        getContentPane().add(btnCartaoCredito1, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 490, -1, -1));

        buttonGroup2.add(btnAvista1);
        btnAvista1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAvista1ActionPerformed(evt);
            }
        });
        getContentPane().add(btnAvista1, new org.netbeans.lib.awtextra.AbsoluteConstraints(530, 560, -1, -1));
        getContentPane().add(imgVisa, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 1544, -1, 37));
        getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
        getContentPane().add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));

        buttonGroup1.add(btnAvista2);
        btnAvista2.setText("Á vista");
        getContentPane().add(btnAvista2, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 490, -1, -1));

        buttonGroup2.add(btnAvista3);
        getContentPane().add(btnAvista3, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 560, -1, -1));

        buttonGroup2.add(btnAvista4);
        getContentPane().add(btnAvista4, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 560, -1, -1));

        btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/edu/ifal/crazypizza/imagens/Botoes_5123_cancel_48.png"))); // NOI18N
        btnCancelar.setText("Cancelar");
        btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarActionPerformed(evt);
            }
        });
        getContentPane().add(btnCancelar, new org.netbeans.lib.awtextra.AbsoluteConstraints(570, 620, -1, 60));

        btnVender.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/edu/ifal/crazypizza/imagens/Botoesaceitar.png"))); // NOI18N
        btnVender.setText("Vender");
        btnVender.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnVenderActionPerformed(evt);
            }
        });
        getContentPane().add(btnVender, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 620, -1, 60));

        ComboNMesa.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }));
        getContentPane().add(ComboNMesa, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 340, -1, -1));

        pnlFundoTexto.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane1.setViewportView(jTextArea1);

        javax.swing.GroupLayout pnlFundoTextoLayout = new javax.swing.GroupLayout(pnlFundoTexto);
        pnlFundoTexto.setLayout(pnlFundoTextoLayout);
        pnlFundoTextoLayout.setHorizontalGroup(
            pnlFundoTextoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlFundoTextoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE)
                .addContainerGap())
        );
        pnlFundoTextoLayout.setVerticalGroup(
            pnlFundoTextoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlFundoTextoLayout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        getContentPane().add(pnlFundoTexto, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 360, -1, -1));
        getContentPane().add(txtNumPedido1, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 280, 90, -1));

        try {
            txtDataPedido1.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        getContentPane().add(txtDataPedido1, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 310, 99, -1));

        txtDataPedido.setBackground(new java.awt.Color(255, 255, 255));
        txtDataPedido.setFont(new java.awt.Font("Comic Sans MS", 1, 12)); // NOI18N
        txtDataPedido.setText("Data Pedido");
        getContentPane().add(txtDataPedido, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 310, -1, -1));

        txtNumeroPedido.setFont(new java.awt.Font("Comic Sans MS", 1, 12)); // NOI18N
        txtNumeroPedido.setText("Nº do Pedido");
        getContentPane().add(txtNumeroPedido, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 280, -1, -1));

        jRadioButton1.setText("Pizza Normal");
        jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton1ActionPerformed(evt);
            }
        });
        getContentPane().add(jRadioButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 320, -1, -1));

        imgHiper.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/edu/ifal/crazypizza/imagens/bandeiras_compra_site_sem_juros hiper.png"))); // NOI18N
        getContentPane().add(imgHiper, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 520, -1, 30));

        lblVisa.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/edu/ifal/crazypizza/imagens/bandeiras_compra_site_sem_juros visa.png"))); // NOI18N
        getContentPane().add(lblVisa, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 520, 50, 30));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/edu/ifal/crazypizza/imagens/bandeiras_compra_site_sem_juros master.png"))); // NOI18N
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(520, 520, -1, 30));

        lblImagem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/edu/ifal/crazypizza/imagens/Tela Login.jpg"))); // NOI18N
        getContentPane().add(lblImagem, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnBebidasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBebidasActionPerformed
    new FrmBebidas().setVisible(true);    // TODO add your handling code here:
    }//GEN-LAST:event_btnBebidasActionPerformed

    private void btnOutrosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOutrosActionPerformed
    new FrmOutros().setVisible(true);    // TODO add your handling code here:
    }//GEN-LAST:event_btnOutrosActionPerformed

    private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
       int opcao = JOptionPane.showConfirmDialog(null,  
    "Deseja cancelar a venda ?", "Encerrar", JOptionPane.YES_NO_OPTION);  
    boolean flag; 
    
     flag = opcao == JOptionPane.YES_OPTION; 
    this.dispose();
    // TODO add your handling code here:
    }//GEN-LAST:event_btnCancelarActionPerformed

    private void btnVenderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVenderActionPerformed
    
        if (txtDataPedido1.getText().equals("") == true||txtNumPedido1.getText().equals("") == true){
           JOptionPane.showMessageDialog(null, "Preencha o seu pedido","Nome Incorrecto", JOptionPane.ERROR_MESSAGE);

       }else{

            JOptionPane.showMessageDialog(null, "Sua Pizza foi criada !");
            this.dispose();
        } 
              // TODO add your handling code here:
       
    // TODO add your handling code here:
    }//GEN-LAST:event_btnVenderActionPerformed

    private void btnPizzaPersonalizadaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPizzaPersonalizadaActionPerformed
        new FrmPedidoPizza().setVisible(true);

        // TODO add your handling code here:
    }//GEN-LAST:event_btnPizzaPersonalizadaActionPerformed

    private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed
    new FrmPizzaNormal().setVisible(true);    // TODO add your handling code here:
    }//GEN-LAST:event_jRadioButton1ActionPerformed

    private void btnAvista1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAvista1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnAvista1ActionPerformed
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FrmVendas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FrmVendas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FrmVendas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FrmVendas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new FrmVendas().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox ComboNMesa;
    private javax.swing.JRadioButton btnAvista1;
    private javax.swing.JRadioButton btnAvista2;
    private javax.swing.JRadioButton btnAvista3;
    private javax.swing.JRadioButton btnAvista4;
    private javax.swing.JRadioButton btnBebidas;
    private javax.swing.JToggleButton btnCancelar;
    private javax.swing.JRadioButton btnCartaoCredito1;
    private javax.swing.JRadioButton btnOutros;
    private javax.swing.JRadioButton btnPizzaPersonalizada;
    private javax.swing.JToggleButton btnVender;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.ButtonGroup buttonGroup3;
    private javax.swing.JLabel imgHiper;
    private javax.swing.JLabel imgVisa;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextArea jTextArea2;
    private javax.swing.JToggleButton jToggleButton1;
    private javax.swing.JLabel lblControleDeCaixa;
    private javax.swing.JLabel lblFormaPagamento;
    private javax.swing.JLabel lblImagem;
    private javax.swing.JLabel lblNome;
    private javax.swing.JLabel lblProdutos;
    private javax.swing.JLabel lblVisa;
    private javax.swing.JPanel pnlClientes;
    private javax.swing.JPanel pnlFundoTexto;
    private javax.swing.JLabel txtDataPedido;
    private javax.swing.JFormattedTextField txtDataPedido1;
    private javax.swing.JTextField txtNome;
    private javax.swing.JLabel txtNumMesa;
    private javax.swing.JTextField txtNumPedido1;
    private javax.swing.JLabel txtNumeroPedido;
    // End of variables declaration//GEN-END:variables
}
